1. Field of the Invention
The present invention relates to a portable electronic device called an "IC card" incorporating an IC (Integrated Circuit) chip having an erasable nonvolatile memory and a control element such as a CPU and, more particularly, to a portable electronic device in which subprograms to be executed by a control element can be registered in a nonvolatile memory.
2. Description of the Related Art
In recent years, an IC card incorporating an IC chip having an erasable nonvolatile memory and a control element such as a CPU has been developed as an advanced portable data storing medium. In such an IC card, the internal control element accesses the internal memory to input/output necessary data in accordance with a request from external equipment.
As an IC card of this type, an IC card in which subprograms (e.g., an encryption program used in a data write mode) to be executed by a main program of the card can be registered in a nonvolatile memory has been developed.
In a conventional IC card of this type, however, since subprograms can be registered a number of times, the subprograms may be illegally rewritten.
In addition, in order to execute a subprogram, whether data in the subprogram is valid must be checked. If the subprogram is invalid, an operation error is caused.
Furthermore, in order to execute a subprogram, whether the subprogram is registered must be checked. Otherwise, whether the subprogram is to be executed cannot be determined.